package com.bawei.park2211a.park


import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.LinearLayoutManager

import com.alibaba.android.arouter.facade.annotation.Route
import com.bawei.base.bean.NoticeEntity
import com.bawei.base.mvvm.BaseActivity

import com.bawei.park2211a.databinding.ActivityParkBinding
import com.blankj.utilcode.util.ToastUtils
import dagger.hilt.android.AndroidEntryPoint

import kotlinx.coroutines.launch

@AndroidEntryPoint
@Route(path = "/app/park/ParkActivity")
class ParkActivity : BaseActivity<ActivityParkBinding,ParkViewModel>() {

    val parkAdapter by lazy { ParkAdapter() }
    override fun initView() {
        lifecycleScope.launch {
            viewModel.getParksByType().collect {
                parkAdapter.submitData(it)
            }
        }
        binding.rvPark.apply {
            adapter=parkAdapter
            layoutManager=LinearLayoutManager(this@ParkActivity)
        }
        parkAdapter.setOnItemClickListener(object :ParkAdapter.OnItemClickListener{

            override fun OnClickListener(position: Int, data: NoticeEntity) {
                ToastUtils.showLong(data.toString())
            }

        })
    }

    override fun initData() {

    }
}